﻿using System;
using System.Windows.Forms;
using RentalOfCars.Client.Presentation;
using System.Collections.Generic;

namespace RentalOfCars.Client.WinformsClient
{
    public partial class AddCarWindow : Form, IAddCarWindowView
    {
        public AddCarWindow()
        {
            InitializeComponent();
        }

        #region IAddCarWindowView Members

        public int Cost
        {
            get { return int.Parse(_tbxCost.Text); }
        }

        public int Price
        {
            get { return int.Parse(_tbxPrice.Text); }
        }

        public IDictionary<string, string> Features
        {
            get
            {
                throw new Exception();
            }
        }
        public string[] AvailableFeatures 
        {
            set
            {
                throw new Exception();
            }
        }
        public string Brand
        {
            get
            {
                return _cbxBrand.Items[SelectedBrandIndex].ToString();
            }
        }

        public string[] Brands
        {
            set
            {
                _cbxBrand.Items.Clear();
                foreach (string brand in value)
                {
                    _cbxBrand.Items.Add(brand);
                }
            }
        }

        public int SelectedFeatureIndex
        {
            get { return _cbxFeature.SelectedIndex; }
        }

        public int SelectedBrandIndex
        {
            get { return _cbxBrand.SelectedIndex; }
        }

        public Action OnOk { private get; set; }

        public void CloseWindow()
        {
            Close();
        }

        public void ShowWindow()
        {
            ShowDialog();
        }

        #endregion
    }
}